package OBS;

/**
 *
 * @author Jesper Wistoft Nielsen
 */
public class OBSReportSubscriber {
    private int ID;
    private String name;
    private String email;
    private OBSReportSubscription OBSReportSubscription = new OBSReportSubscription(null);

    /**
     * @param ID
     * @param name
     * @param email
     * @param OBSReportSubscription
     */
    public OBSReportSubscriber (int ID, String name, String email, OBSReportSubscription OBSReportSubscription) {
        this.ID = ID;
        this.name = name;
        this.email = email;
        if(OBSReportSubscription != null) {
            this.OBSReportSubscription = OBSReportSubscription;
        }
    }

    /**
     * 
     * @return
     */
    public String toString() {
        return name;
    }

    /**
     * 
     * @return
     */
    public int getID() {
        return ID;
    }

    /**
     * 
     * @return
     */
    public String getEmail() {
        return email;
    }

    /**
     * 
     * @param email
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * 
     * @return
     */
    public String getName() {
        return name;
    }

    /**
     * 
     * @param name
     */
    public void setSubscriberName(String name) {
        this.name = name;
    }

    /**
     * 
     * @return
     */
    public OBSReportSubscription getOBSReportSubscription() {
        return this.OBSReportSubscription;
    }

    /**
     * 
     * @param OBSReportSubscription
     */
    public void setOBSReportSubscription(OBSReportSubscription OBSReportSubscription) {
        if(OBSReportSubscription != null) {
            this.OBSReportSubscription = OBSReportSubscription;
        }
        else {
            this.OBSReportSubscription = new OBSReportSubscription(null);
        }
    }

    /**
     * 
     * @param o
     * @return
     */
    public boolean equals(Object o) {
        if (!(o instanceof OBSReportSubscriber)) {
            return false;
        }
        OBSReportSubscriber OBSReportSubscriber = (OBSReportSubscriber)o;
        return (this.name.equals(OBSReportSubscriber.getName()) && (this.ID == OBSReportSubscriber.getID()));
    }
}